package com.javajun.spider.bt7086.service;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.javajun.spider.bt7086.entity.Video;
import com.javajun.spider.bt7086.repository.VideoRepository;

@Component
public class VideoServiceComponent {
	
	@Autowired
	private VideoRepository repository;
	
	private static VideoServiceComponent videoServiceComponent;
	
	@PostConstruct //通过@PostConstruct实现初始化bean之前进行的操作
	public void init() {
		videoServiceComponent = this;
		videoServiceComponent.repository = this.repository; 
	}
	
	
	public Video save(Video entity) {
		return videoServiceComponent.repository.save(entity);
	}

}
